package com.indusfo.spc.controller;

import com.indusfo.spc.aspect.SystemControllerLog;
import com.indusfo.spc.pojo.DeviceType;
import com.indusfo.spc.pojo.DeviceTypeInspect;
import com.indusfo.spc.pojo.MatType;
import com.indusfo.spc.service.DeviceTypeService;
import com.indusfo.spc.service.MatTypeService;
import com.indusfo.spc.vo.JSONObject;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.ResponseBody;

import javax.annotation.Resource;

/**
 * @author louk
 * @description 物料类别接口
 * @date 2019/11/19 9:40
 */
@Controller
@RequestMapping("/service/deviceType")
public class DeviceTypeController {

    /**
     * 注入service
     */
    @Resource
    DeviceTypeService deviceTypeService;

    /**
     * 新增
     * @param deviceType
     * @return
     */
    @RequestMapping(value="insertDeviceType")
    @ResponseBody
    public JSONObject insertDeviceType(DeviceType deviceType){
        JSONObject json = deviceTypeService.insertDeviceType(deviceType) ;
        return json;

    }

    /**
     * 删除
     * @param deviceTypeId
     * @param dataState
     * @return
     */
    @RequestMapping(value="defineDeviceType")
    @ResponseBody
    public JSONObject defineDeviceType(Integer deviceTypeId,Integer  dataState){
        JSONObject json = deviceTypeService.defineDeviceType(deviceTypeId,dataState);
        return json;

    }

    /**
     * 修改
     * @param deviceType
     * @return
     */
    @RequestMapping(value="updateDeviceType")
    @ResponseBody
    public JSONObject updateDeviceType(DeviceType deviceType){
        JSONObject json = deviceTypeService.updateDeviceType(deviceType) ;
        return json;

    }


    /**
     * 树
     * @param deviceType
     * @return
     */
    @RequestMapping(value="treeDeviceType")
    @ResponseBody
    public JSONObject treeDeviceType(DeviceType deviceType){
        JSONObject json = deviceTypeService.treeDeviceType(deviceType);
        return json;

    }


    /**
     * 树
     * @param deviceType
     * @return
     */
    @RequestMapping(value="queryAllDeviceType")
    @ResponseBody
    public JSONObject queryAllDeviceType(DeviceType deviceType){
        JSONObject json = deviceTypeService.queryAllDeviceType(deviceType);
        return json;

    }
    /**
     * 过滤设备类型下的明细后的设备保养项目明细
     * @param deviceType
     * @return com.indusfo.spc.vo.JSONObject
     */
    @RequestMapping(value="/filterMaintain")
    @ResponseBody
    public JSONObject filterMaintain(DeviceType deviceType) {

        JSONObject json = deviceTypeService.filterMaintain(deviceType);
        return json;
    }
    /**
     * 过滤设备类型下的明细后的设备点检项目明细
     * @param deviceType
     * @return com.indusfo.spc.vo.JSONObject
     */
    @RequestMapping(value="/filterInspect")
    @ResponseBody
    public JSONObject filterInspect(DeviceType deviceType) {

        JSONObject json = deviceTypeService.filterInspect(deviceType);
        return json;
    }

}
